#include <iostream>
#include <vector>
#include <algorithm>
#include<queue>
#include <string>
using namespace std;

class Solution {
public:
    int E(const string& s,int& ix){
        int a = T(s,ix);
        int n = s.size();
        while(ix < n && (s[ix]=='+' || s[ix]=='-')){
            char c = s[ix++];
            int b = T(s,ix);
            if(c=='+'){
                a+=b;
            } else {
                a-=b;
            }
        }
        return a;
    }

    int T(const string& s,int& ix){
        int a = V(s,ix);
        int n = s.size();
        while(ix < n && (s[ix]=='*' || s[ix]=='/')){
            char c = s[ix++];
            int b = V(s,ix);
            if(c=='*'){
                a *= b;
            } else {
                a /= b;
            }
        }
        return a;
    }

    int V(const string& s,int& ix){
        int n = s.size();
        int val = 0;
        while(ix < n && isdigit(s[ix])){
            val = val*10 + s[ix]-'0';
            ix++;
        }
        return val;
    }

    int calculate(string s) {
        /**
        编译 上下文无关文法
        E -> T {+|- T}
        T -> V {*|/ V}
        V -> num 
        **/
        string b;
        for(auto ch:s){
            if(ch!=' '){
                b += ch;
            }
        }
        int ix=0;
        return E(b,ix);
    }
};

int main()
{
    Solution solution;
    solution.calculate("3/2");

    return 0;
}